//
//  AboutLayer.cpp
//  airfight
//
//  Created by lahm on 12-12-11.
//  Copyright (c) 2012年 moonriver. All rights reserved.
//

#include "AboutLayer.h"
#include "MenuLayer.h"

bool AboutLayer::init()
{
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    m_SpriteFrameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
    m_SpriteFrameCache->addSpriteFramesWithFile("airfight.plist","airfight.png");
    m_SpriteBatch = CCSpriteBatchNode::create("airfight.png");
    
    CCSprite *back = CCSprite::create();
    back->initWithSpriteFrameName("about.png");
    back->setPosition(ccp(160, 240));
    addChild(back);
    
    CCLabelTTF *label0 = CCLabelTTF::labelWithString("策划", CCSize(120, 50), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "", 18);
    label0->setPosition(ccp(160,400));
    addChild(label0);
    
    CCLabelTTF *label1 = CCLabelTTF::labelWithString("白彬 周闻", CCSize(120, 50), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "", 18);
    label1->setPosition(ccp(160, 380));
    addChild(label1);
    
    CCLabelTTF *label2 = CCLabelTTF::labelWithString("程序", CCSize(120, 50), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "", 18);
    label2->setPosition(ccp(160, 330));
    addChild(label2);
    
    CCLabelTTF *label3 = CCLabelTTF::labelWithString("唐东育 刘博文", CCSize(120, 50), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "", 18);
    label3->setPosition(ccp(160, 310));
    addChild(label3);
    
    CCLabelTTF *label4 = CCLabelTTF::labelWithString("商务邮箱", CCSize(120, 50), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "", 18);
    label4->setPosition(ccp(160, 260));
    addChild(label4);
    
    CCLabelTTF *label5 = CCLabelTTF::labelWithString("arcticbaby@163.com", CCSize(200, 50), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "", 18);
    label5->setPosition(ccp(160, 230));
    addChild(label5);
    
    CCLabelTTF *label6 = CCLabelTTF::labelWithString("合作电话", CCSize(120, 50), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "", 18);
    label6->setPosition(ccp(160, 190));
    addChild(label6);
    
    CCLabelTTF *label7 = CCLabelTTF::labelWithString("(86)13911408146", CCSize(200, 50), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "", 18);
    label7->setPosition(ccp(160, 160));
    addChild(label7);
    
    CCSprite *backBtn = CCSprite::create();
    backBtn->initWithSpriteFrameName("button.png");
    CCSprite *backBtnClicked = CCSprite::create();
    backBtnClicked->initWithSpriteFrameName("button.png");
    backBtnClicked->setScale(0.95);
    CCMenuItemSprite *backMenuItem = CCMenuItemSprite::itemWithNormalSprite(backBtn, backBtnClicked, backBtn, this, menu_selector(AboutLayer::clickBack));
    backMenuItem->setPosition(ccp(220, 80));
    CCLabelTTF *labelBack = CCLabelTTF::labelWithString("返回", CCSize(50, 30), kCCTextAlignmentLeft, kCCVerticalTextAlignmentCenter, "", 15);
    labelBack->setPosition(ccp(230, 82));
    
    CCMenu *menu = CCMenu::menuWithItems(backMenuItem,NULL);
    menu->setPosition(CCPointZero);
    addChild(menu);
    addChild(labelBack);
    
    return true;
}

void AboutLayer::startLoading()
{
    
}

void AboutLayer::onEnter()
{
    CCLayer::onEnter();
    scheduleOnce(schedule_selector(AboutLayer::startLoading), 0);
}

void AboutLayer::clickBack()
{
    CCScene *pScene = CCScene::create();
    CCLayer *pLayer = MenuLayer::create();
    pScene->addChild(pLayer);
    CCDirector::sharedDirector()->replaceScene(pScene);
}
